<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Article Edit</title>
#{stylesheet 'main.css'/}
#{stylesheet 'style.css'/}
#{script src='jquery-1.9.1.min.js'/}
<!--导入kindeditor(富文本编辑器)相关文件-->
#{script src='kindeditor/kindeditor.js'/}
#{script src='kindeditor/lang/zh_CN.js'/}

<!--初始化kindeditor-->
<script>
$(document).ready(function(){
	var options = {
		width : '506px',
		minWidth: 506,
		uploadJson : '@{Ajax.addArticleImg}',
		fileManagerJson : '@{Ajax.addArticleManager}',
		allowFileManager : true,
		autoHeightMode : true,
		afterCreate : function() {this.loadPlugin('autoheight');},
		resizeType : 1,
		allowPreviewEmoticons : false,
		items : [
				'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
				'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
				'insertunorderedlist', '|', 'image', 'link', 'unlink', 'table', '|', 'about']
	};
	KindEditor.ready(function(K) {
		window.editor = K.create('#editor_acticle',options);
	});
	//提交表单后关闭弹出层，并且刷新父界面
	$("form").submit(function(e){
		parent.layer.close();
		parent.location.reload();
	});
});
</script>
</head>
<body>
#{form @Form.editArticle()}
<div class="form">
	<div class="form_row">
		<label>Title:</label>
		<input type="text" class="form_input" name="article.title" value="${art.title}"/>
		<span class="error">#{error 'article.title'/}</span>
	</div>
	<div class="form_row">
		<label>Introduce:</label>
		<input type="text" class="form_input" name="article.introduce" value="${art.introduce}"/>
		<span class="error">#{error 'article.introduce'/}</span>
	</div>
	<div class="form_row">
		<label>Content:</label>
		<textarea class="form_textarea" name="article.content" id="editor_acticle">${art.content}</textarea>
		<span class="error">#{error 'article.content'/}</span>
	</div>
	<div class="form_row">
		<input type="hidden" value="${art.id}" name="article.id">
		<input type="submit" class="form_submit" value="Submit" />
	</div> 
	<div class="clear"></div>
</div>
#{/form}
</body>
</html>